home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / mx / managers / SystemManager.as < prev   
Text File  |  2007-11-08  |  3KB  |  103 lines

  1. class mx.managers.SystemManager
  2. {
  3.    static var _initialized = false;
  4.    static var idleFrames = 0;
  5.    static var isMouseDown = false;
  6.    static var forms = new Array();
  7.    function SystemManager()
  8.    {
  9.    }
  10.    static function init(Void)
  11.    {
  12.       if(mx.managers.SystemManager._initialized == false)
  13.       {
  14.          mx.managers.SystemManager._initialized = true;
  15.          mx.events.EventDispatcher.initialize(mx.managers.SystemManager);
  16.          Mouse.addListener(mx.managers.SystemManager);
  17.          Stage.addListener(mx.managers.SystemManager);
  18.          mx.managers.SystemManager._xAddEventListener = mx.managers.SystemManager.addEventListener;
  19.          mx.managers.SystemManager.addEventListener = mx.managers.SystemManager.__addEventListener;
  20.          mx.managers.SystemManager._xRemoveEventListener = mx.managers.SystemManager.removeEventListener;
  21.          mx.managers.SystemManager.removeEventListener = mx.managers.SystemManager.__removeEventListener;
  22.       }
  23.    }
  24.    static function addFocusManager(f)
  25.    {
  26.       mx.managers.SystemManager.form = f;
  27.       f.focusManager.activate();
  28.    }
  29.    static function removeFocusManager(f)
  30.    {
  31.    }
  32.    static function onMouseDown(Void)
  33.    {
  34.       var _loc1_ = mx.managers.SystemManager.form;
  35.       _loc1_.focusManager._onMouseDown();
  36.    }
  37.    static function onResize(Void)
  38.    {
  39.       var _loc7_ = Stage.width;
  40.       var _loc6_ = Stage.height;
  41.       var _loc9_ = _global.origWidth;
  42.       var _loc8_ = _global.origHeight;
  43.       var _loc3_ = Stage.align;
  44.       var _loc5_ = (_loc9_ - _loc7_) / 2;
  45.       var _loc4_ = (_loc8_ - _loc6_) / 2;
  46.       if(_loc3_ == "T")
  47.       {
  48.          _loc4_ = 0;
  49.       }
  50.       else if(_loc3_ == "B")
  51.       {
  52.          _loc4_ = _loc8_ - _loc6_;
  53.       }
  54.       else if(_loc3_ == "L")
  55.       {
  56.          _loc5_ = 0;
  57.       }
  58.       else if(_loc3_ == "R")
  59.       {
  60.          _loc5_ = _loc9_ - _loc7_;
  61.       }
  62.       else if(_loc3_ == "LT")
  63.       {
  64.          _loc4_ = 0;
  65.          _loc5_ = 0;
  66.       }
  67.       else if(_loc3_ == "TR")
  68.       {
  69.          _loc4_ = 0;
  70.          _loc5_ = _loc9_ - _loc7_;
  71.       }
  72.       else if(_loc3_ == "LB")
  73.       {
  74.          _loc4_ = _loc8_ - _loc6_;
  75.          _loc5_ = 0;
  76.       }
  77.       else if(_loc3_ == "RB")
  78.       {
  79.          _loc4_ = _loc8_ - _loc6_;
  80.          _loc5_ = _loc9_ - _loc7_;
  81.       }
  82.       if(mx.managers.SystemManager.__screen == undefined)
  83.       {
  84.          mx.managers.SystemManager.__screen = new Object();
  85.       }
  86.       mx.managers.SystemManager.__screen.x = _loc5_;
  87.       mx.managers.SystemManager.__screen.y = _loc4_;
  88.       mx.managers.SystemManager.__screen.width = _loc7_;
  89.       mx.managers.SystemManager.__screen.height = _loc6_;
  90.       _root.focusManager.relocate();
  91.       mx.managers.SystemManager.dispatchEvent({type:"resize"});
  92.    }
  93.    static function get screen()
  94.    {
  95.       mx.managers.SystemManager.init();
  96.       if(mx.managers.SystemManager.__screen == undefined)
  97.       {
  98.          mx.managers.SystemManager.onResize();
  99.       }
  100.       return mx.managers.SystemManager.__screen;
  101.    }
  102. }
  103.